package com.yxhl.zoume.domain.interactor.mywallet;

import com.yxhl.zoume.data.http.repository.mywallet.MyWalletRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.mywallet.TradeRecordsParam;
import com.yxhl.zoume.data.http.rest.response.mywallet.TradeRecordsResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * 项目名称：Ferrari
 * Created by menggod on 2016/11/13.
 */

public class TradeRecordsUseCase extends UseCase<TradeRecordsResponse> {
    private MyWalletRepository mMyWalletRepository;

    @Inject
    public TradeRecordsUseCase(
            @Named(DomainConstants.UI_THREAD) Scheduler uiThread,
            @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
            MyWalletRepository myWalletRepository) {
        super(uiThread, executorThread);
        mMyWalletRepository = myWalletRepository;
    }

    @Override
    protected Observable<TradeRecordsResponse> buildObservable(RequestParamImpl param) {
        return mMyWalletRepository.queryTradeRecords((TradeRecordsParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
